<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let arr1 = [1,2,3,4,5,2,2,6,7,2,9];
        let set1 = new Set(arr1);
        console.log(set1);
        let arr2 = [...set1]; // 展开运算符（另一个用法是剩余参数）
        console.log(arr2);
        // =========================
        let str1 = 'hello';
        let set2 = new Set(str1);
        console.log(set2);
        let arr3 = [...set2];
        console.log(arr3.join(''));
        // =========================
        set1.add(2,1,4,5,8); // 加不进去，可以将所有的数据放在对象或者数组中，一次性添加
        set1.delete(8); // 删除一项 如果删的是不存在的值就默默失败
        let res = set1.has(3);
        console.log(res);
        set1.clear()
        console.log(set1);
    </script>
</body>
</html>